/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package bean;

import java.lang.reflect.Field;

/**
 *
 * @author HoangNam
 */
public class Master {

    public void setAttribute(String field, Object val) {
        try {
            Class c = Class.forName(this.getClass().getName());
            Field f = c.getDeclaredField(field);
            f.setAccessible(true);
            f.set(this, val);
        } catch (ClassNotFoundException | IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException ex) {
            System.out.println(ex);
        }
    }
}
